package com.ty.user.starter.entity.dto;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * @author minku
 * @since 2021-10-16
 */
@Data
public class DeptDto implements Serializable {

    private static final long serialVersionUID = -2177742632572260214L;

    @ApiModelProperty("id")
    private Long id;

    /**
     * 一级部门parentId默认为0
     */
    @ApiModelProperty("父id")
    @NotNull(message = "父id不能为空")
    private Long parentId = 0L;

    @ApiModelProperty(value = "部门名称", required = true)
    @NotBlank(message = "部门名称不能为空")
    @Length(min = 1, max = 20, message = "部门名称长度介于1~20位")
    private String name;

    @ApiModelProperty(value = "排序", required = true)
    @NotNull(message = "排序值不能为空")
    @Range(min = 0, max = 100, message = "排序值介于1~100之间")
    private Integer sort = 0;

    @ApiModelProperty("备注")
    @Length(min = 1, max = 100, message = "备注长度介于1~100位")
    private String remark;

}
